package com.sdkj.recruit.controller;

import java.io.File;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.sdkj.recruit.service.IFileService;

@Controller
@Path("/file")
public class FileTestController {

	@Autowired
	private IFileService fileService;

	/**
	 * 保存文件
	 */
	@POST
	@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
	@Path("/saveFile")
	public void saveFile() {
		File list = new File("F:\\data10");
		File[] fl = list.listFiles();
		for (File f : fl) {
			fileService.saveFile(f.getName(), f);
		}
	}

	/**
	 * 获取文件
	 */
	@POST
	@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
	@Path("/getFile")
	public void getFile() {
		fileService.getFileByte("5b552e86fa32d431107e4f85");
	}
}
